package huizhi.miniotest;

import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.UploadObjectArgs;
import io.minio.errors.*;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class ExerciseDemo1 {
    public static void main(String[] args)
            throws IOException, NoSuchAlgorithmException, InvalidKeyException, ServerException, InsufficientDataException, ErrorResponseException, InvalidResponseException, XmlParserException, InternalException {
        // Create a minioClient with the MinIO server playground, its access key and secret key.
        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint("http://10.247.157.72:3702")
                        .credentials("minioadmin", "minioadmin")
                        .build();
        minioClient.uploadObject(
                UploadObjectArgs.builder()
                        .bucket("test1")
                        .object("liunx.txt")
                        .filename("C:\\Users\\Administrator\\Desktop\\linux.txt")
                        .build());
        System.out.println(
                "'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
                        + "object 'asiaphotos-2015.zip' to bucket 'asiatrip'.");


    }
}
